/*
 * TimeUtil.h
 *
 *  Created on: 2018年7月15日
 *      Author: zhengboyuan
 */

#ifndef TIMEUTIL_H_
#define TIMEUTIL_H_

#include <time.h>
#include <string>

namespace util
{

class TimeUtil
{
public:
    TimeUtil();
    virtual ~TimeUtil();

    static std::string format(time_t t);

    static std::string format(time_t t, int ms);

    static bool parse(const std::string& str, time_t& t);
    
    static time_t toMinute(time_t t);
    static time_t toHour(time_t t);
    static time_t toDay(time_t t);

    static time_t toMonth(time_t t);
    static time_t addMonth(time_t t, int months);
    static time_t toYear(time_t t);
    static time_t addYear(time_t t, int years);

	static time_t toWeekDay(time_t t);
	static time_t toNextWeekDay(time_t t);

	static time_t addDay(time_t t, int days);

    static time_t toQuarter(time_t t);
    static time_t addQuarter(time_t t, int count);

};


} /* namespace util */

#endif /* TIMEUTIL_H_ */
